window.onload = function () {
    var xhr = new XMLHttpRequest()
    xhr.open('get', "/studio/album/published.json")
    xhr.onload = function () {
        var body = document.querySelector('body')
        var data = JSON.parse(xhr.responseText)
        for (var i in data) {
            var result = data[i]
            console.log(result)
            var html = `<button onclick="skipTo(${result.aid})">
                         <input type="hidden" name="aid" value="${result.aid}"><div><img src="${result.cover}" class="cover"></div>
                         <div><h1>${result.title}</h1></div>
                         <div>作者：${result.username} (${result.uid})</div></button>`
            body.innerHTML += html
        }
    }
    xhr.send()
}
function skipTo(aid) {
    window.location.href = `/studio/album/display.html?aid=${aid}`
}
